#-*- codeing = utf-8 -*-
#@Time : 2020/9/24 23:02
#@Author : 阳某
#@File : 时间.py
#@Software : PyCharm
# import math
# import time
# 不用函数
# start = time.time()     #开始计时
# lst = []
# for i in range(1,10000000):
#     lst.append(math.sqrt(i))
# end = time.time()
# print(end-start)    # 2.8s

# import math
# import time
# # 使用函数
# def func():
#     lst = []
#     for i in range(1,10000000):
#         lst.append(math.sqrt(i))
#     return lst
# start = time.time()     #开始计时
# lst = func()
# end = time.time()
# print(end-start)    # 2.5s

# # 去掉属性访问
# from math import sqrt
# import time
# # 使用函数
# def func():
#     lst = []
#     for i in range(1,10000000):
#         lst.append(sqrt(i))
#     return lst
# start = time.time()     #开始计时
# lst = func()
# end = time.time()
# print(end-start)    # 2.2s

# 去掉属性访问
from math import sqrt
import time
# 使用函数
def func():
    lst = [sqrt(i) for i in range(1,10000000)]
    return lst
start = time.time()     #开始计时
lst = func()
end = time.time()
print(end-start)    # 1.8s
